#include "MyMinStack.h"

bool MyMinStack::isEmpty()
{
	return m_valueStack.isEmpty();
}

int MyMinStack::getSize()
{
	return m_valueStack.getSize();
}

void MyMinStack::push(int value)
{
	m_valueStack.push(value);
	if (this->isEmpty())
	{
		m_minStack.push(value);
	} 
	else
	{
		int minValue = m_minStack.getHead();
		if(value<minValue)
			m_minStack.push(value);
	}
}

int MyMinStack::pop(void)
{
	int value = m_valueStack.pop();
	if(value<m_minStack.getHead())
		m_minStack.pop();

	return value;
}

int MyMinStack::getHead()
{
	return m_valueStack.getHead();
}

int MyMinStack::getMin()
{
	return m_minStack.getHead();
}